import React from 'react'
import { connect } from 'react-redux'
import { LoginWrapper } from './style'
import { Input, Button } from 'antd'
import './login.css'
import { actionCreators } from './store'
 
class Login extends React.Component {
	render(){
    return (    
        <div className="login-dog">
          <h5>欢迎来到登陆页面</h5>
          <Input defaultValue = '请输入账号' style={{width:'300px',margin:'5px auto' }} innerRef={(input) => {this.account = input}}></Input><br/>
          <Input defaultValue = '请输入密码' style={{width:'300px',margin:'5px auto' }} innerRef={(input) => {this.password = input}}></Input><br/>
          <Button type='primary' style={{margin:'5px auto',width:'300px'}} onClick={() => this.props.login(this.account,this.password)}>登录</Button>
          <Button block style={{margin:'5px auto',width:'300px'}}>注册</Button>
        </div>
    )
  }
}


const mapDispatch = (dispatch) => ({
	login(accountElem, passwordeElem){
		dispatch(actionCreators.login(accountElem.value,passwordeElem.value));
	}
});


export default connect(null, mapDispatch)(Login)